#include "st.h"
#include <stdio.h>
#include "bsp.h"
#include "uart.h"

#include "App.h"

#include "pad.h"

u8 auto_start_mzj = 1;
u8 auto_start_cnt = 0;

char *paLaserTypeNames[] =
{
    "Unknown",
	"F250S-A", "F300S-A",
	"F300S_L",
	"F300S-C"
};

StatusType   spt;

u8 app_first_run = 1;


static int last_pos = 0;
static u8 pos_not_change_cnt = 0;

void ST_Default(MSG *m)
{
    s32 pos = 0;
    s8  delta = 0;
    static u8 delay_run_cnt = 0;
    //    char da[32]={0};
    switch ( m->message )
    {
    case WM_STATE_ENTER:
        break;

    case WM_TMR_SEC:
        ZM_GetPos();
        if ( delay_run_cnt < 3 )
        {
            delay_run_cnt++;
        }
        else
        {

        }
        break;
    case WM_ZM_GOT_POS:
        pos = (s32)m->param;
        if ( zm_reset == 0 )
        {
            if ( pos >= -5 && pos <= 5 )
            {
                PostMessage(WM_ZM_FIND_ZERO, 0);
                zm_reset = 1;
            }
        }
        break;
    case WM_ZM_FIND_ZERO:
        pos = 0;
        break;
    case WM_ZM_IN_PLACE:
        pos = zm_cur_pos;
        break;
    case WM_MOTOR_RUN_OK:
		break;
    case WM_TCP_RecvDat:
//    	tcp_parse((char *)m->param);
    	break;

    }
}
